<ul class="breadcrumb">
  <li><a href="/">首页</a> <span class="divider">/</span></li>
  <li><a href="/exams">考试信息</a> <span class="divider">/</span></li>
  <li class="active">所有考试</li>
</ul>
<p>
  <%= link_to '新建考试记录', new_exam_path %> </p>
<script type="text/javascript">
    $(document).ready(function() {
                $("table").tablesorter({
                    sortList: [
                        [2,1]
                    ]  ,
                    headers: { 4: { sorter: false} }
                });
            }
    );
</script>
<table class="zebra-striped bordered-table">
  <thead>
  <tr>
    <th>标题</th>
    <th>描述</th>
    <th>时间</th>
    <th>上课班级</th>
    <th>操作</th>
  </tr>
  </thead>
  <tbody>
  <% @exams.each do |exam| %>
      <tr>
        <td><%= link_to truncate(exam.title, :length=>12), exam %></td>
        <td><%= truncate(exam.description, :length=>18) %></td>
        <td><%= exam.ctime.strftime("%Y-%m-%d  %H:%M") %></td>
        <td>
          <%=
              if exam.scope.split(',').size ==5
                  "所有分组"
              else
                  exam.scope
              end
          %>
        </td>
        <td><%= link_to '查看成绩', :controller => "scores", :action => "index", :eid=>exam.id %>
          <%= link_to '编辑', edit_exam_path(exam) %>
          <%= link_to '删除', exam, confirm: '删除本次考试同时会删除本次考试的所有成绩,确认删除?', method: :delete %></td>
      </tr>
  <% end %>
  </tbody>
</table>

<br/>

